package io;

import java.io.*;

public class CopyDemo {
    public static void main(String[] args) throws IOException {
//        FileInputStream fis = new FileInputStream("./image.png");
//        FileOutputStream fos = new FileOutputStream("./image_p.png");
//        int d;
//        long stats = System.currentTimeMillis();
//        while ((d = fis.read()) != -1){
//            fos.write(d);
//        }
//        long end = System.currentTimeMillis();
//        System.out.println("复制完毕，经历了：" + (end - stats) + "ms");
//        fis.close();
//        fos.close();


//        FileInputStream fis = new FileInputStream("./image.png");
//        FileOutputStream fos = new FileOutputStream("./image_p.png");
//
//        int d;
//        while ((d = fis.read()) != -1){
//            fos.write(d);
//        }
//        System.out.println("复制完毕");
//        fos.close();
//        fis.close();

        FileInputStream fis = new FileInputStream("./image.png");
        FileOutputStream fos = new FileOutputStream("./image_png");
        long stats = System.currentTimeMillis();
        int d;
        while ((d = fis.read()) != -1){
            fos.write(d);
        }
        long end = System.currentTimeMillis();
        System.out.println("复制完毕,一共用时" + (end - stats));
        fos.close();
        fis.close();













    }
}
